﻿#ifndef __AF_PLAYER_H__
#define __AF_PLAYER_H__

#include "AF_Define.h"

namespace AF
{
	class Player;
}
typedef AF::Player			AF_CPlayer;

#define AF_AUDIO_ALLCHANNL		-1
#define AF_AUDIO_FREECHANNL		-1

namespace AF
{
	enum ChannlState
	{
		CS_PLAY,
		CS_PAUSE,
		CS_STOP
	};
}

#include "AF_Audio.h"
#include "AF_Bundle.h"

namespace AF
{
	/// 媒体播放基类
	class _ABSTRACT Player
	{
	private:
		struct Channl
		{
			ChannlState	cs;
			Audio*		pAudio;
			bool		isLoop;
		};

	public:
		Player(){}
		virtual ~Player(){}

	public:
		/// 初始化播放器
		virtual bool		Init(AF_CBundle* pArgs = NULL) = 0;
		/// 销毁播放器
		virtual bool		Destroy() = 0;

	public:
		/// 开始播撿
		virtual bool		Play(AF_CAudio* pAudio, int nChannl = AF_AUDIO_FREECHANNL, bool isLoop = false)
					{return false;}
		/// 开始播撿
		virtual bool		Play(const _STRING strPathName, int nChannl = AF_AUDIO_FREECHANNL, bool isLoop = false)
					{return false;}
		/// 暂停播放
		virtual bool		Pause(int nChannl = AF_AUDIO_ALLCHANNL)
					{return false;}
		/// 停止播放
		virtual bool		Stop(int nChannl = AF_AUDIO_ALLCHANNL)
					{return false;}

	public:
		/// 设置音量
		virtual void		SetVolume(UINT nVolume, int nChannl = AF_AUDIO_ALLCHANNL)
					{return;}
		/// 获取音量
		virtual int		GetVolume(int nChannl)
					{return 0;}
	};
}

#endif